package com.ruyixing.shopmanager.http;

import org.json.JSONObject;

import com.ruyixing.shopmanager.model.Login;

public class LoginParser extends RYJSONParser {
	@Override
	public Object parse(JSONObject jsonObject) {
		if (getErrno(jsonObject) != NO_ERROR) {
			return null;
		}

		Login login = new Login();

		ModelParser.parseModel(login, jsonObject);
		JSONObject data = jsonObject.optJSONObject("data");
		login.bduss = data.optString("bduss");
		login.nickname = data.optString("nickname");
		login.avatar = data.optString("avatar");
		login.livecity = data.optString("livecity");
		login.photo = data.optInt("photo", 0);
		login.review = data.optInt("review", 0);
		login.signin = data.optInt("signin", 0);
		return login;
	}
}
